package com.ict.web.controller.yzq;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.github.pagehelper.PageInfo;
import com.ict.web.dto.ComplianceAddDto;
import com.ict.web.dto.ComplianceEditDto;
import com.ict.web.vo.ComplianceDetalisVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ict.common.annotation.Log;
import com.ict.common.core.controller.BaseController;
import com.ict.common.core.domain.AjaxResult;
import com.ict.common.enums.BusinessType;
import com.ict.web.domain.Compliance;
import com.ict.web.service.IComplianceService;
import com.ict.common.utils.poi.ExcelUtil;
import com.ict.common.core.page.TableDataInfo;

/**
 * 合规审查Controller
 *
 * @author ruoyi
 * @date 2022-02-14
 */
@Api(tags = "合规审查")
@RestController
@RequestMapping("/compliance")
public class ComplianceController extends BaseController
{
    @Autowired
    private IComplianceService complianceService;

    /**
     * 查询合规审查列表
     */
//    @PreAuthorize("@ss.hasPermi('web:compliance:list')")
    @ApiOperation("查询合规审查列表")
    @GetMapping("/list")
    public PageInfo<Compliance> list(Compliance compliance)
    {
        startPage();
        List<Compliance> list = complianceService.selectComplianceList(compliance);
        return new PageInfo<>(list);
    }

    /**
     * 获取合规审查详细信息
     */
//    @PreAuthorize("@ss.hasPermi('web:compliance:query')")
    @ApiOperation("获取合规审查详细信息")
    @GetMapping(value = "/{complianceId}")
    public ComplianceDetalisVo getInfo(@PathVariable("complianceId") Long complianceId)
    {
        return complianceService.selectComplianceByComplianceId(complianceId);
    }

    /**
     * 新增合规审查
     */
//    @PreAuthorize("@ss.hasPermi('web:compliance:add')")
    @ApiOperation("新增合规审查")
    @Log(title = "合规审查", businessType = BusinessType.INSERT)
    @PostMapping
    public Long add(@RequestBody ComplianceAddDto dto)
    {
        return complianceService.insertCompliance(dto);
    }

    /**
     * 修改合规审查
     */
//    @PreAuthorize("@ss.hasPermi('web:compliance:edit')")
    @ApiOperation("修改合规审查")
    @Log(title = "合规审查", businessType = BusinessType.UPDATE)
    @PutMapping("/edit/{complianceId}")
    public AjaxResult edit(@RequestBody ComplianceEditDto dto,@PathVariable Long complianceId)
    {
        return toAjax(complianceService.updateCompliance(dto,complianceId));
    }

    /**
     * 删除合规审查
     */
//    @PreAuthorize("@ss.hasPermi('web:compliance:remove')")
    @ApiOperation("删除合规审查")
    @Log(title = "合规审查", businessType = BusinessType.DELETE)
	@DeleteMapping("/{complianceId}")
    public AjaxResult remove(@PathVariable Long complianceId)
    {
        return toAjax(complianceService.deleteComplianceByComplianceId(complianceId));
    }
}
